package com.bjesc_b2c.app.appraiset.widget.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.bjesc_b2c.app.appraiset.R;
import com.bjesc_b2c.app.appraiset.widget.BaseDialog;

/**
 * Created by lenovo on 2017/2/24.
 */

public class TipDialog extends BaseDialog implements View.OnClickListener {

    private CallBack callBack;
    private TextView messageTv;
    private Context context;
    public TipDialog(Context context,CallBack callBack) {
        super(context);
        this.callBack = callBack;
        this.context = context;
        initViews();
    }

    private void initViews() {
        view = inflater.inflate(R.layout.dialog_tip,null);
        messageTv = (TextView) view.findViewById(R.id.tv_analyse_tip);
        view.findViewById(R.id.tv_cancel).setOnClickListener(this);
        view.findViewById(R.id.tv_sure).setOnClickListener(this);
        setContentView(view);
    }

       public void setMessageText(final String str){
           new Thread(new Runnable() {
               @Override
               public void run() {
                   messageTv.setText(str);
               }
           }).start();
       }


    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.tv_cancel:
                dismiss();
                break;
            case R.id.tv_sure:
            if(callBack!=null){
                callBack.tipCallBack();
            }
                dismiss();
                break;
        }
    }

    public interface CallBack{
        void tipCallBack();
    }
}
